package com.xysoft.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class Role extends DataEntityImpl{
	private String name;
	private boolean front;
	private String remark;
	private Organization organization;
	private Set<UserRole> userRoles;
	private Set<RoleAction> roleActions;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@OneToMany(mappedBy="role", fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
	public Set<UserRole> getUserRoles() {
		return userRoles;
	}
	public void setUserRoles(Set<UserRole> userRoles) {
		this.userRoles = userRoles;
	}
	@OneToMany(mappedBy="role", fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
	public Set<RoleAction> getRoleActions() {
		return roleActions;
	}
	public void setRoleActions(Set<RoleAction> roleActions) {
		this.roleActions = roleActions;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "organizationID")
	public Organization getOrganization() {
		return organization;
	}
	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	public boolean isFront() {
		return front;
	}
	public void setFront(boolean front) {
		this.front = front;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
}
